#include <stdio.h>

void search(char* str_in, char* str_out, char begin, char end)
{
    char * p_begin = str_in;
    char * p_end = NULL;
    while(*p_begin != begin && p_begin != 0)p_begin++;
    p_end = p_begin;
    while(*++p_end);
    while(*--p_end != end && p_end >= p_begin);
    while (p_begin <= p_end)
    {
        *str_out++ = *p_begin++;
    }
    *str_out = 0;
}

int main()
{
    char str[80];
    char str_re[80];
    char begin, end;
    scanf("%s %c %c", str, &begin, &end);
    search(str, str_re, begin, end);
    printf("%s\n", str_re);
    return 0;
}